package terminal.network;

public class Message {

    private String msg;
    private String sendMsg;

    public Message(String symbol, String msgType) {
        msg = ("35=" + msgType + "\r49=SE\r56=CMU\r55=" + symbol + "\r");
    }

    public String getMsg() {
        int sum = 0;

        for (int i = 0; i < msg.length(); i++) {
            char c = msg.charAt(i);
            int j = c;
            sum += j;
        }
        int checksum = sum % 256;

        sendMsg = ("8=FIX.5.5\r9=24\r" + msg + "10=" + String.valueOf(checksum) + "\r");

        return sendMsg;
    }
}